<script src="../../../../../imagesUI/trunk/zhanghao/build/1.00/js/zhanghao.js"></script>
<template>
    <div>
        <div class="top-header border-bottom fixed-top" style="z-index:99">
            <div class="top-back">
                <a href="/vue/center">返回</a>
            </div>
            <h2 class="f36 color-000">我的订单</h2>
            <div class="top-right" @click="moreClick">
                <a class="sharelist"></a>
            </div>
        </div>
        <!-- 买家列表 -->
        <div class="sellmanage-main mt-205">
            <div class="sellnage-nav tab fixed-top border20-bottom mt-97">
                <ul class="tab-nav">
                    <li class="fl border-bottom f30 " :class="{active: payStatus==-1}"><a  @click="goOrderStatus(-1)">全部</a></li>
                    <li class="fl border-bottom f30 " :class="{active: payStatus==0}"><a  @click="goOrderStatus(0)">待付款</a></li>
                    <li class="fl border-bottom f30 " :class="{active: payStatus=='1|2'}"><a  @click="goOrderStatus('1|2')">交易中</a></li>
                    <li class="fl border-bottom f30 " :class="{active: payStatus==3}"><a  @click="goOrderStatus(3)">交易成功</a></li>
                </ul>
            </div>
			<div class="mobile-order-tips py-20 px-30 mb-20 bg-fffdf4" v-if="msgBox1">
            <i class="fl icon-close-yellow" @click="closeTips2"></i>
            <p id="tips" class="ml-20 fl f26 ">买家订单改版啦~~~游戏币、装备、帐号、手游订单都可以在这里查看啦~~~</p>
            <!-- <a class="fr text-center f26" href="http://trading.5173.com/list/myorder_manage.aspx">去电脑版</a> -->
        </div>
            <div class="sellnage-connt mb-20" v-for="item in orderList">
                <div class="manage-caption px-30  bg-fff" >
                    <div class="manage-titl py-30 f28"><span
                        class=" fl mr-30 fontbold">{{getJsondata(item)}}</span></div>
                    <div class="manage-contn bg-faf" @click="goOrder(item)">
                        <div class="mancon-img fl"><i class="f22 color-fff bg-000">{{item.orderinfo.obizoffertypename!='null'?item.orderinfo.obizoffertypename:''}}</i><span
                            class="middle"></span>
                            <img :src="item.orderinfo.PicUrlManager" v-if="item.orderinfo.PicUrlManager">
                            <img v-else src="~images/default_img.jpg">
                        </div>
                        <div class="mancon-tn py-15  ">
                            <!--有区服商品-->
                            <div class="tn-hxtxt f26 color-666" v-if="item.orderinfo.ogamearea&&item.orderinfo.otradingtype!=4">
                                {{item.orderinfo.ogamename}} /{{item.orderinfo.ogamearea}} /{{item.orderinfo.ogameserver}}
                            </div>
                            <!--无区服商品-->
                            <div class="tn-hxtxt f26 color-666" v-if="!item.orderinfo.ogamearea&&item.orderinfo.otradingtype!=4">
                                {{item.orderinfo.ogamename}}
                            </div>
							<!-- 点卡 -->
							<div class="tn-hxtxt f26 color-666" v-if="item.orderinfo.otradingtype==4">
                                {{item.orderinfo.ogamename}}
                            </div>
                            <div class="tn-hxtxt f26 color-666" v-if="!item.orderinfo.MoneyName">订单编号：{{item.oid}}</div>
                            <div class="tn-hxtxt f26 color-666">订单价格：{{item.orderinfo.opayprice}}元
                              <div class="mbl-icon fr" v-if="item.orderinfo.oordersource=='Sy.GameAccount'||item.orderinfo.oordersource=='Sy.GameStartAccount'">
                                <i class="zhao" v-if="item.orderinfo.osellersigns && ~item.orderinfo.osellersigns.indexOf('找回包赔')"></i>
                                <i class="shang" v-if="item.orderinfo.obuyersigns && ~item.orderinfo.obuyersigns.indexOf('商品保障险')"></i>
                                <i class="maijia" v-if="item.orderinfo.obuyersigns && ~item.orderinfo.osellersigns.indexOf('卖家保险')"></i>
                              </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="mancon-titl px-30 py-30 bg-fff border-bottom " ><span
                    class="title-curent f30 pl-30 color-000 buyct-why"  v-if="!item.CancelReasons||item.orderstatus.oorderstatusid!=4">{{item.orderstatus.oorderstatusname}}</span>
                    <span  class="title-curent f30 pl-30 color-000 fl buyct-why " v-if="item.CancelReasons&&item.orderstatus.oorderstatusid==4">取消原因：{{item.CancelReasons}}</span>
                    <p class="title-detail-tip px-30 mt-10 f28 color-666 clearflex" v-if="
                    (item.orderinfo.oordersource=='Sy.GameAccount'||item.orderinfo.oordersource=='Sy.GameStartAccount')
                    &&item.orderstatus.oorderstatusname=='交易成功'
                    &&item.orderinfo.osellersigns
                    &&item.orderinfo.osellersigns.indexOf('找回包赔')!='-1'"
                    >
                		该帐号卖家已缴纳保险金，承诺帐号如被找回将全额赔付。</p>
                </div>
                <div class="mancon-btn pr-20 py-20 bg-fff border-bottom ">
                    <em class="total fl pl-30 f30" v-if="item.Price">总价：<i class="color-m1">￥{{item.orderinfo.oprice}}</i></em>
                    <!--主站联系客服-->
                    <a class="f30 color-m1 border border-color " v-if="item.orderinfo.otradingtype!=7&&item.orderinfo.oshowcontactop=='true'" @click="getKefu(item)">联系客服</a>
                    <!--M站联系客服-->
                    <a class="f30 color-m1 border border-color " v-if="item.orderinfo.otradingtype==7&&!item.recharge&&!item.Equipment&&item.orderinfo.oordersource!='M.GameMoney'&&item.orderstatus.oorderstatusid!=0&&(item.orderinfo.oordersource!='M.MobileGameMoney'||item.orderstatus.oorderstatusid!=4)" @click="getKefu(item)">联系客服</a>
                    <!--通用按钮-->
                    <a class="f30 color-fff bg-m1" v-if="showPay(item)" @click="getPay(item)">去付款</a>
                    <!--账号按钮-->
                    <a class="f30 color-fff border border-color bg-m1 fr" v-if="showAccount(item)" @click="getAccount(item)">提取账号</a>
                    <!--装备按钮-->
                    <a  class="f30 color-fff border border-color bg-m1 fr" @click="confirmEq(item.oid)"  v-if="item.orderstatus.oorderstatusid==2&&item.Equipment">确认收货</a>
                    <a class="f30 color-m1 border border-color fr" @click="eqRefund(item.oid,1,1)" v-if="(item.orderstatus.oorderstatusid==1||item.orderstatus.oorderstatusid==2)&&item.Equipment">申请退款</a>
                    <a class="f30 color-m1 border border-color fr" v-if="item.orderstatus.oorderstatusid==3&&item.Equipment&&!item.isAxm" @click="appeal(item.oid)">申诉</a>
                    <a class="f30 color-m1 border border-color fr" v-if="item.orderstatus.oorderstatusid==3&&item.isAxm" @click="accountRefund(item.oid)">申请退款</a>
                    <!--充值按钮-->
                    <a class="f30 color-m1 border border-color cancel fr" v-if="item.recharge&&item.orderstatus.oorderstatusid==3" @click="appealReceive(item.oid)">申诉</a>
                    <a class="f30 color-fff border border-color bg-m1 fr" @click="rechargeAccount({orderId:item.oid})" v-if="item.recharge&&item.orderstatus.oorderstatusid==2&&item.rechargeType=='Msy.FirstRecharge'">提取账号</a>
                    <a class="f30 color-m1 border border-color fr"  v-if="item.recharge&&(item.orderstatus.oorderstatusid==1||item.orderstatus.oorderstatusid==2||item.orderstatus.oorderstatusid==3)"  @click="linkSeller(item.ContactSeller)">联系卖家</a>
                    <a class="f30 color-m1 border border-color fr"  v-if="item.recharge&&(item.orderstatus.oorderstatusid==1||item.orderstatus.oorderstatusid==2)" :href="'tel:'+item.SellerPhone">拨打电话</a>
                    <a class="f30 color-m1 border border-color fr" v-if="item.recharge&&(item.orderstatus.oorderstatusid==1||item.orderstatus.oorderstatusid==2)" @click="refund({orderId:item.oid,status:item.orderstatus.oorderstatusid})">我要退款</a>
                    <a class="f30 color-m1 border border-color cancel fr" v-if="item.recharge&&item.orderstatus.oorderstatusid==3&&item.rechargeType=='Msy.ReplaceRecharge'" :href="'/vue/recharge/order/'+item.oid+'?order=true'">再来一单</a>
                    <a class="f30 color-m1 border border-color cancel fr" v-if="item.recharge&&item.orderstatus.oorderstatusid==3&&item.rechargeType=='Msy.AppleRecharge'" :href="'/vue/recharge/quickRecharge'">再来一单</a>
                    <a class="f30 color-m1 border border-color cancel fr" v-if="item.recharge&&item.orderstatus.oorderstatusid==3&&(item.rechargeType!='Msy.ReplaceRecharge'&&item.rechargeType!='Msy.AppleRecharge')" :href="'/vue/recharge/refill/refillInfo/'+item.SellerGameAccount">我要续充</a>
                </div>
            </div>
            <div class="loading" v-show="loading">加载中...</div>
            <div class="list-empty bg-fff" v-show="orderList.length===0&&!loading">
                <p><img src="~images/gamelogo.png"></p>
                <span>您还没有订单</span>
            </div>
            <more></more>
        </div>
    </div>
</template>
<script>
	import { mapState, mapGetters, mapActions } from 'vuex'
	import {BuyerCenterApi} from 'api/index'
	import more from 'components/common/More.vue'
	import config from 'components/im/config'
	import SDK from 'components/im/sdk/NIM_Web_SDK_v4.0.0.js'
	export default {
		data() {
			return {
				payStatus: this.$route.params.status,
				moreShow: false,
				paysta: true,
				loading:false,
				orderList:[],
				jsPath:'http://consignment.5173.com/ajax.axd?methodName=GetOrderIMInfo',
				dbPath:'http://danbao.5173.com/ajax.axd?methodName=GetOrderIMInfo',
				zhPath:'http://gameid.5173.com/BankInfo.axd?methodName=GetOrderIMInfo',
				syPath:'http://sy.5173.com/api/order/getorderim',
				scPath:'http://yxbmall.5173.com/gamegold-facade-frontend/services/orderdata/getOrderIm',
				url: location.protocol+'//'+location.hostname+'/api/mobile-order-service/rs/orderdata/getOrderIm',
				//url: 'http://syt.5173.com/api/mobile-order-service/rs/orderdata/getOrderIm',
				msgBox1:true
			}
		},
		components: {
			more
		},
		watch: {
			errMsg(msg) {
				if (msg && Object.keys(msg).length > 0) {
					this.$messagebox({
						title: '提示',
						message: msg.message,
						closeOnClickModal: false
					}).then(() => {
						this.clearErr()
						if (msg.returnUrl) {
							location.href = msg.returnUrl
						}
					})
				} else {
					if (document.getElementsByClassName("mint-msgbox-wrapper").length > 0) {
						this.$messagebox.close()
					}
				}
			},
			warnMsg(msg) {
				if (msg && Object.keys(msg).length > 0) {
					this.$toast({
						message: msg.message,
						duration: msg.duration || 2500,
						position: msg.position || 'middle'
					})
					if (msg.duration) {
						setTimeout(() => {
							this.clearWarn()
						}, msg.duration)
					} else {
						setTimeout(() => {
							this.clearWarn()
						}, 3000)
					}
				}
			},
		},
		created:function () {
			// if (this.$isLocalStorageSupported()) {
			// 	if(sessionStorage.getItem("msgBox1")){
			// 		this.msgBox1 = sessionStorage.getItem("msgBox1")
			// 	}
			// }
			// if(this.msgBox1 == true){
			// this.$messagebox('买家订单改版啦~~~游戏币、装备、帐号、手游订单都可以在这里查看啦~~~').then( sessionStorage.setItem("msgBox1",false))
	 		// }
		},
		computed: {
			...mapState({
				maypayUrl: state => {
					return state.buyerCenter.maypayUrl
				},
				errMsg: state => {
					return state.buyerCenter.errMsg
				},
				warnMsg: state => {
					return state.buyerCenter.warnMsg
				},
			})
		},
		mounted: function mounted() {

			this.$bus.on('headMoreStatus', sta => {
				this.moreShow = sta
			})
            this.getDataList()
			window.addEventListener('scroll', this.scrollHander)
			this.setXiaoNeng()
		},
		beforeDestroy: function beforeDestroy() {
			window.removeEventListener('scroll', this.scrollHander)
		},
		methods: {
			closeTips2(){
				 this.msgBox1 = false
			},
            // 小能客服配置
			setXiaoNeng() {
				const s1 = document.createElement('script');
				s1.type = 'text/javascript';
				s1.text = 'NTKF_PARAM = {' +
					'siteid: "bq_1000",' +
					'settingid: "bq_1000_9999",' +
					'uid: "",' +
					'uname: "",' +
					'isvip: "0",' +
					'userlevel: "1",' +
					'erpparam: "abc"' +
					'}';
				document.body.appendChild(s1);
				const s = document.createElement('script');
				s.type = 'text/javascript';
				s.src = encodeURI('https://dl.ntalker.com/js/b2b/ntkfstat.js?siteid=bq_1000');
				s.charset = "utf-8";
				document.body.appendChild(s);
			},
			//主站寄售联系客服
			async getServiceParams(item) {
				var self = this;
				var params = {
					methodName: "GETTRADEORDERIMINFO",
					orderid: item.oid,
					usertype: 1,
					tradingtype: item.orderinfo.otradingtype,
					clienttype: 2
				};
				await BuyerCenterApi.getPcServer(params).then(res => {
					if (res) {
						if (res.serverType == 1) {
							self.getPcService(item.oid, item.orderinfo.otradingtype);
						} else if (res.serverType == 2) {
							location.assign(
								"https://sh-v2.ntalker.com/downt/t2d/chat.php?v=2017.08.23&siteid=bq_1000&settingid=" +
								res.params +
								"&baseuri=https%3A%2F%2Fdl.ntalker.com%2Fjs%2Fb2b%2F&mobile=1&ref=https%3A%2F%2Fm.5173.com%2Fvue%2Fmobile-game%2Fgoods-list2%2F76bae5aefec047e89bcb6aa4e417f138%2F%25E7%258E%258B%25E8%2580%2585%25E8%258D%25A3%25E8%2580%2580%2F2&tit=%E7%8E%8B%E8%80%85%E8%8D%A3%E8%80%80&iframechat=0&header=1&rnd=1512371179444"
							);
						} else if (res.serverType == 3) {
							window.location.assign(
								"mqqwpa://im/chat?chat_type=wpa&uin=" +
								res.KefuQQ +
								"&version=1&src_type=web&web_src=oicqzone.com"
							);
						}
					}
				});
			},
			//判断待支付显示
			showPay(item){
				var result = false
				if(item.orderstatus.oorderstatusid=='0'){
                    if(item.orderinfo.otradingtype==3||item.orderinfo.otradingtype==7||item.orderinfo.otradingtype==5||(item.orderinfo.otradingtype==6&&item.orderinfo.oordersource!='YXB.XSGameGoods')){
	                    result = true
                    }else {
	                    item.operators.forEach(function (data) {
		                    if(data.name=='立即付款'){
			                    result = true
		                    }
	                    })
                    }
                }
                return result
            },
			showAccount(item){
				var orderinfo = item.orderinfo,isShow = false;
                if(item.orderstatus.oorderstatusid==2||item.orderstatus.oorderstatusid==3){
                	//todo M站商品无具体商品类型判断  全部改成对中文字段判读
	                if(orderinfo.otradingtype==7&&item.orderinfo.obizoffertypename.indexOf('账号')>-1){
 						isShow = true
					}
                }
                return isShow
            },
            //联系卖家
            linkSeller(url){
                location.href =url
            },
            //装备申述
			appeal(orderId) {
				location.href = '/member/member-buyer-appeal.html?orderId=' + orderId
			},
			appealReceive(orderId) {
				this.$messagebox({
					title: '提示',
					message: "交易已经成功，发起申诉，将由客服鉴定是否退款？",
					showCancelButton: true
				}).then((action) => {
					if (action === 'confirm') {
						this.appealReceiveAction({orderId:orderId})
					}
				})
			},
            //安心买申请退款
			accountRefund(orderId) {
				var url = '/member/complaint-axm.html?orderId='+orderId
				if(orderId[0]!='M'){
					url = url + '&isAnxin=true'
				} 
				location.href = url;
			},
            //申请退款
			eqRefund(orderId, goodsType, gameType) {
				location.href = '/member/member-buyer-refund.html?orderId=' + orderId + '&goodsType=' + goodsType + '&gameType=' + gameType
			},
			//确认收货
			confirmEq(orderId) {
				location.href = '/member/member-buyer-equipment-transaction.html?orderId=' + orderId
			},
			getAccount(item) {
				var orderinfo = item.orderinfo
				var orderId = item.oid,type=''
				//todo 订单中心合并后可以考虑合并成一个
				if(orderinfo.ojsondata){
					type = 'mobgoods'
				}else if(orderinfo.otradingtype==3){
					type = 'shouyou'
				}else {
					type = 'pcgoods'
				}
				this.$router.push({
					name: 'getAccount',
					params: {type:type,orderId:orderId}
				})
			},
			moreClick() {
				this.moreShow = !this.moreShow
				this.$bus.emit('moreStatus', this.moreShow)
			},
            //统一字段转换
            getJsondata(item){
				var title = item.orderinfo.otitle
                if(item.orderinfo.obuyersigns){
	                item.isAxm = (item.orderinfo.obuyersigns.indexOf('安心买')>-1)
                }
                if(item.orderinfo.osellersigns){
	                item.isAxm = item.isAxm||(item.orderinfo.osellersigns.indexOf('安心买')>-1)
                }
				if(item.orderinfo.ojsondata){
					var  object =  JSON.parse(item.orderinfo.ojsondata)
					title = object.BizOfferName
					item.orderinfo.PlatformName = object.PlatformName
					item.orderinfo.SubTitle = object.SubTitle
					item.orderinfo.ogamename = object.GameName
					item.orderinfo.ogamearea = object.GameAreaName
					item.orderinfo.ogameserver = object.GameServerName
                    item.orderinfo.obizoffertypename = object.BizOfferTypeName
                    item.orderinfo.PicUrlManager = object.PicUrlManager
                    item.orderinfo.MoneyName = object.MoneyName
					item.CancelReasons = object.CancelReasons
					item.SellerGameAccount = object.SellerGameAccount
                }
	            if(item.orderinfo.oopJsondata){
		            var  oopJsondata =  JSON.parse(item.orderinfo.oopJsondata)
		            item.CustomServiceQQ = oopJsondata.KefuQQ
                }
                if (item.orderinfo.oordersource.indexOf('Msy.')> -1) {
                    item.recharge = true
                    item.rechargeType = item.orderinfo.oordersource
                    var  oremarks =  JSON.parse(item.orderinfo.oremarks)
                    item.SellerPhone = oremarks.SellerPhone
                    item.ContactSeller = oremarks.ContactSeller
                }
                if (item.orderinfo.oordersource.indexOf('M.Equipment')> -1) {
                    item.Equipment = true
                }
                return title
            },
			async getDataList(){
	            var self = this;
				self.pageindex = self.pageindex||1
                var payStatus = self.payStatus
                if(self.payStatus==-1){
	                payStatus = ''
                }
                var params = {
		            orderstatus:payStatus,
		            tradingtype:'',
	                sourcetype:2,
		            pageindex:self.pageindex,
		            pagesize:10,
		            usertype:1,
                }
                if(!self.over){
	                await BuyerCenterApi.getOrderList(params).then(res=>{
		                var  object =  JSON.parse(res.bodyText)
		                if( object.Data.OrderPages.Orders){
			                if(self.pageindex==1){
				                self.orderList = object.Data.OrderPages.Orders
			                }else {
				                self.orderList.push(...object.Data.OrderPages.Orders)
			                }
			                if( object.Data.OrderPages.Orders.length==0||object.Data.OrderPages.Orders.length<10){
				                self.over = true
                            }
		                }
	                })
                }
            },
            //到订单详情
			goOrder(item){
	            var orderinfo = item.orderinfo
	            var otradingtype = parseInt(orderinfo.otradingtype)
	            if(otradingtype==7){
		            if (orderinfo.oordersource.indexOf('Msy.')> -1) {
			            location.href = '/recharge/recharge-buyer-detail1.html?orderId=' + item.oid
		            } else {
			            if (orderinfo.oordersource.indexOf('M.MobileGameAccount') > -1 ||orderinfo.oordersource.indexOf('M.GameAccount') > -1 || orderinfo.oordersource.indexOf('M.GameMoney') > -1 ) {
				            this.$router.push({
					            name: 'buyerOrder',
					            params: {orderId: item.oid, type: 'mobgoods'}
				            })
			            } else if (orderinfo.oordersource.indexOf('M.Equipment') > -1 && (item.orderstatus.oorderstatusid == '1' || item.orderstatus.oorderstatusid == '2'|| item.orderstatus.oorderstatusid == '5')) {
				            location.href = '/member/member-buyer-equipment-transaction.html?orderId=' + item.oid
			            } else if (orderinfo.oordersource.indexOf('M.Equipment') > -1 && item.orderstatus.oorderstatusid == '4') {
				            this.$router.push({
					            name: 'buyerOrder',
					            params: {orderId: item.oid, type: 'mobgoods'}
				            })
			            }else  if(orderinfo.oordersource.indexOf('M.MobileGameMoney') > -1){
				            this.$router.push({
					            name: 'buyerMobCoinOrder',
					            params: {orderId: item.oid}
				            })
                        }
		            }
	            }else if(otradingtype==3&&orderinfo.oordersource.indexOf('Account') > -1 ){
		            this.$router.push({
			            name: 'buyerOrder',
			            params: {orderId: item.oid, type: 'shouyou'}
		            })
	            }else if(otradingtype==6&&orderinfo.oordersource!='YXB.XSGameGoods'){
		            location.href = '/vue/members/goods-detail?orderId=' + item.oid
	            }else if(otradingtype!=4&&otradingtype!=3&&otradingtype<6){
		            this.$router.push({
			            name: 'buyerOrder',
			            params: {orderId: item.oid, type: 'pcgoods'},
			            query: {ServiceType:orderinfo.otradingtype||5}
		            })
	            } else if (otradingtype == 3 && ~orderinfo.oordersource.indexOf('Sy.GameMoney')) { // 主站金币
	            	this.$router.push({
			            name: 'buyerPcCoinOrder',
			            params: {orderId: item.oid}
		            })
	            } else {
		            this.$messagebox({
			            title: '提示',
			            message: '骚年，常回电脑看看啊'
		            })
	            }
            },
            getPay(item){
	            var orderinfo = item.orderinfo
	            if(orderinfo.otradingtype==7){
                    if (orderinfo.oordersource.indexOf('Msy.')> -1) {
	                    this.rechargePay(item.oid)
                    } else {
                        this.mobPay(item.oid,orderinfo.oordersource)
                    }
	            }else if(orderinfo.otradingtype==3){
                    this.shouyouPay(item.oid)
	            }else if(orderinfo.otradingtype==6&&orderinfo.oordersource!='YXB.XSGameGoods'){
		            location.href=`http://yxbmall.5173.com/gamegold-facade-frontend/mPayment?orderId=`+item.oid
	            }else if(orderinfo.otradingtype==5){
                    location.href=`http://gameid.5173.com/OrderPage/GoPayfor.aspx?OrderId=`+item.oid
                }else {
		            item.operators.forEach(function (data) {
			            if(data.name=='立即付款'){
	                        location.href = data.do
                        }
		            })
                }
            },
            getKefu(item){
				var orderinfo = item.orderinfo
                if(orderinfo.otradingtype==7){
					if(orderinfo.oordersource=='M.MobileGameMoney'){
						window.location.assign('mqqwpa://im/chat?chat_type=wpa&uin=' + orderinfo.CustomServiceQQ + '&version=1&src_type=web&web_src=oicqzone.com')
                    }else {
						this.getService(item.oid)
                    }

                }else if(orderinfo.otradingtype==3||orderinfo.otradingtype==6){
                    this.getPcService(item.oid,orderinfo.otradingtype)
                }else if(orderinfo.otradingtype == 10){
					if(orderinfo.oopJsondata){
						var obj = JSON.parse(orderinfo.oopJsondata)
						if(/baidu/i.test(navigator.userAgent.toLowerCase())||/MicroMessenger/i.test(navigator.userAgent.toLowerCase())){
							this.$messagebox({
								message: "如点击联系客服无法启动QQ，请加客服QQ号("+obj.KefuQQ+")"
							})
						}else {
							window.location.assign('mqqwpa://im/chat?chat_type=wpa&uin=' + obj.KefuQQ + '&version=1&src_type=web&web_src=oicqzone.com')
						}
					}
                }else{
					this.getServiceParams(item)
				}
            },
			goCustomer(val, url) {
      			if (Object.keys(val).length) {
            		if (val.DefaultIM==1 || (val.DefaultIM==2 && val.WYCustomService) || (val.DefaultIM==2 && !val.WYCustomService && val.IsOpenHX)||(!val.DefaultIM&&val.IsOpenHX&&val.DefaultIM!=0)) {
                		location.href=`/member/huanxin1.html?url=${encodeURIComponent(url)}`
           			 	} else {
               			 if(/baidu/i.test(navigator.userAgent.toLowerCase())||/MicroMessenger/i.test(navigator.userAgent.toLowerCase())){
                    	this.$messagebox({
                        message: "如点击联系客服无法启动QQ，请加客服QQ号("+val.CustomServiceQQ+")"
                    		})
                	}else {
                    window.location.assign('mqqwpa://im/chat?chat_type=wpa&uin=' + val.CustomServiceQQ + '&version=1&src_type=web&web_src=oicqzone.com')
                }
            }
        }
			},
            //主站商品联系客服（主站未开启环信暂用版本）
			getPcService(Id, ServiceType) {
				//账号5 寄售2 担保1
				let url = ''
				switch (parseInt(ServiceType)) {
					case 10:
						url = this.scPath
						break;
					case 6:
						url = this.scPath
						break;
					case 5:
						url = this.zhPath
						break;
					case 2:
						url = this.jsPath
						break;
					case 3:
						url = this.syPath
						break;
					case 1:
						url = this.dbPath
						break;
					default:
				}
				let urlpath = this.$concatUrl({orderid:Id,usertype:1,tradingtype:ServiceType,callback:'callback'},url)
				BuyerCenterApi.getOrderIm(urlpath).then (res => {
					if (res.data) {
						if (res.data.Order) {
							this.goCustomer(res.data.Order, urlpath)
						}else{
//							this.$toast({ message: '联系客服失败，请稍后重试' })
							NTKF.im_openInPageChat('bq_1000_1472795888825');
						}
					}
				})

			},
            //M站商品联系客服
            getService(orderId) {
				let url = this.$concatUrl({orderId, userType:1, callback:'callback'},this.url)
                BuyerCenterApi.getOrderIm(url).then(res=>{
					if (res.data) {
						if (res.data.Order) {
								this.goCustomer(res.data.Order, url)
						}else{
							NTKF.im_openInPageChat('bq_1000_1472795888825');
						}
					}
				})
			},
            //手游充值支付功能
			rechargePay(orderId) {
				location.href = '/recharge/recharge-paying.html?orderId=' + orderId
			},
			//M站商品支付功能
			async mobPay(orderId, goodsType, gameType) {
				let returnUrl;
				if (goodsType == 'M.Equipment') {
					returnUrl = location.protocol + '//' + location.hostname + '/member/member-buyer-equipment-transaction.html?from=payed&orderId=' + orderId
				} else {
					returnUrl = location.protocol + '//' + location.hostname + '/vue/buyerCenter/buyerOrder/mobgoods/' + orderId + '?from=payed'
				}
				if (gameType == 'M.MobileGameMoney') { // 手游金币
					returnUrl = location.protocol + '//' + location.hostname + '/vue/buyerCenter/buyerMobCoinOrder/' + orderId
				}
				if (orderId.indexOf('MAO') > -1 || orderId.indexOf('MEO') > -1 || orderId.indexOf('MGO') > -1) {
					await this.maypay({
						orderId: orderId,
						returnUrl: returnUrl
					})
					if (this.maypayUrl) {
						location.href = this.maypayUrl
					}
				} else {
					this.$router.push({
						name: 'singlePay',
						params: {
							orderId: orderId
						}
					})
				}
			},
            //主站手游
			shouyouPay(orderId) {
				if (this.paysta) {
					this.paysta = false
					var promise =  this.mobileOrderPay({orderId:orderId,sourceChannel:2})
					this.paysta = true
					promise.then(function (payUrl) {
						location.href = 'https://mypay.5173.com/PaymentWap/PayExternalV2.aspx?' + payUrl
					})

				}
			},
            //申述&&退款
			refund(params) {
				if (params.status === '1') {
					this.$messagebox({
						title: '提示',
						message: "确定发起退款吗？",
						showCancelButton: true
					}).then((action) => {
						if (action === 'confirm') {
							this.rechargeRefund({orderId: params.orderId})
						}
					})
				} else {
					this.$messagebox({
						title: '提示',
						message: "卖家已发货！发起申诉，将由客服鉴定是否退款？",
						showCancelButton: true
					}).then((action) => {
						if (action === 'confirm') {
							this.appealSure({orderId: params.orderId})
						}
					})
				}
			},
			async scrollHander() {
				if (this.$isBottom(500)&&!this.stopscroll) {
					this.stopscroll = true
					if(this.pageindex){
						this.pageindex++
						await this.getDataList()
                    }
					this.stopscroll = false
				}
			},
			goOrderStatus(s) {
            	var self = this
            	if(self.payStatus!=s){
		            self.payStatus = s
		            self.pageindex = 1;
		            self.orderList = [];
		            self.over = false
		            self.getDataList();
		            self.$router.push({
			            name: 'buyOrderList',
			            params: {
				            status: s
			            }
		            })
                }

			},
			...mapActions({
				mobileOrderPay: 'buyerCenter/MOBILEORDERPAY',
				rechargeRefund: 'buyerCenter/RECHARGEREFUND',
				appealReceiveAction:'buyerCenter/APPEALRECEIVE',
				appealSure: 'buyerCenter/APPEALSURE',
				maypay: 'buyerCenter/MAYPAY',
				rechargeAccount: 'buyerCenter/QUERYORDERDETAIL',
			})
		}
	}
</script>
<style src="css/common/member-cxy.css"></style>
<style scoped>
    .mancon-btn em.total {
        height: .7rem;
        line-height: .7rem;
    }

    .loading {
        text-align: left;
        text-indent: .6rem;
        line-height: .5rem;
        height: .5rem;
        background: url('~images/loading.gif') left center no-repeat;
        background-size: .5rem;
        margin-top: -.1rem;
        margin-left: 2.5rem;
    }

    .mancon-btn a {
        position: relative;
    }

    .contantSeller {
        position: absolute;
        top: -.2rem;
        background: #C92025;
        color: #fff;
        width: .45rem;
        height: .45rem;
        right: -.1rem;
        line-height: 0.45rem !important;
        border-radius: 10rem;
    }

    .bgm1 {
        background-color: #f75e46;
    }
    .clearflex{
      clear: both;
      overflow: hidden;
      display: block;
    }
    .mancon-tn .mbl-icon i {
      display: inline-block;
      float: left;
      width: 0.4rem;
      height: 0.4rem;
    }
    .mancon-tn .mbl-icon i.zhao {
        background: url("~images/Icon/equ-zhao.png") no-repeat right center;
        background-size: 0.32rem
    }
    .mancon-tn .mbl-icon i.shang {
        background: url("~images/Icon/equ-shang.png") no-repeat right center;
        background-size: 0.32rem
    }
    .mancon-tn .mbl-icon i.maijia {
        background: url("~images/Icon/mbl-mai.png") no-repeat right center;
        background-size: 0.32rem
    }
</style>
